const { validator } = require('../validator')

//
const createValidator = validator({
  name: { type: 'string', required: true },
  passwd: { type: 'string', required: true },
  phone: { type: 'string', required: true },
})

const updateValidator = validator({
  id: { type: 'int', required: true },
  name: { type: 'string', required: true },
  passwd: { type: 'string', required: false },
})

const updatePwdValidator = validator({
  newPasswd: { type: 'string', required: true },
  passwd: { type: 'string', required: true },
})

const loginValidator = validator({
  phone: { type: 'string', required: true },
  passwd: { type: 'string', required: true },
  code: { type: 'string', required: true },
  random: { type: 'string', required: true },
})

const getValidator = validator({
  id: { type: 'int', required: true },
})

const delValidator = validator({
  id: { type: 'int', required: true },
})

const listValidator = validator({
  pageNo: { type: 'int', required: true },
  pageSize: { type: 'int', required: true },
})

const unlockValidator = validator({
  id: { type: 'int', required: true },
})

module.exports = {
  getValidator,
  createValidator,
  updateValidator,
  delValidator,
  listValidator,
  loginValidator,
  updatePwdValidator,
  unlockValidator,
}
